﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Retirement/retirement.master" AutoEventWireup="true"
    CodeFile="funds.aspx.cs" Inherits="Retirement_funds" %>

<asp:Content ID="Content" ContentPlaceHolderID="retirement_ContentPlaceHolder" runat="Server">

    <h2 id="heading">
        <a href="../home.aspx">World Trade Bank</a> > <a href="home.aspx">Retirement</a> > Our Funds</h2>
    <style type="text/css">
        .tbl_legend td
        {
            text-align: center;
            border: 0px solid #808080;
        }
        
        .tbl_funds th, td
        {
            border: 1px solid #808080;
            text-align: left;
            height:30px;
        }
        .tbl_funds th
        {
            background-color: #B40404;
            color: #FFFFFF;
        }
        
        .Grid th  
        {
            background-color: #B40404;
            color: #FFFFFF;
            height:30px;
        }

    </style>
    <h7 style="font-family: 'TheSansCdRegular','Lucida Grande','Lucida Sans Unicode', Helvetica, Arial, sans-serif;
        font-weight: normal; font-size: 54px; line-height: 52px; color: #333333; letter-spacing: -1pt;
        margin: 0 0 10px 0;">
        World Trade Fund Latest Fund Pricing
    </h7>
    <br />
    <br />
       <%-- <table class="tbl_legend" width="30%" style="float:right">
        <tr>
            <td>Legend
            </td>
            <td><asp:Image ID="legend_PriceUp" runat="server" ImageUrl="~/Retirement/Images/price_up.gif" />
            </td>
            <td><asp:Image ID="legend_PriceDown" runat="server" ImageUrl="~/Retirement/Images/price_down.gif" />
            </td>
            <td><asp:Image ID="legend_PriceNoChange" runat="server" ImageUrl="~/Retirement/Images/no_change.gif" />
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>Price Up
            </td>
            <td>Price Down
            </td>
            <td>No Change
            </td>
        </tr>
    </table>--%>
    <br /><br />

    <asp:GridView ID="gv_funds" runat="server" DataSourceID="SqlDataSource1" 
        AutoGenerateColumns="False" Width="100%" CssClass="Grid">
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="fund_code" 
                DataNavigateUrlFormatString="~/Retirement/funds.aspx?fundCode={0}" 
                DataTextField="fund_name" HeaderText="Fund Name" >
            <ControlStyle ForeColor="#333333" />
            </asp:HyperLinkField>
            <asp:BoundField DataField="currency" HeaderText="Currency" 
                SortExpression="currency" />
            <asp:BoundField DataField="offer_price" HeaderText="Offer Price" 
                SortExpression="offer_price" />
            <asp:BoundField DataField="bid_price" HeaderText="Bid Price" 
                SortExpression="bid_price" />
            <asp:BoundField DataField="valuation_date" HeaderText="Valuation Date" 
                SortExpression="valuation_date" DataFormatString="{0:d}" />
        </Columns>
    </asp:GridView>

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="select * from (SELECT M.fund_code,
		M.fund_name,
		valuation_date,
		bid_price,
		offer_price,
		currency,
       (select Max(offer_price) price from R_FUND_DAILY_PRICE Sub
      where 
		 Sub.fund_code=M.fund_code and CONVERT(nvarchar(50),Sub.valuation_date,103) = CONVERT(nvarchar(50),GETDATE()-1 ,103)
      ) old_price
FROM 
  R_FUND_DAILY_PRICE R, R_FUND M where R.fund_code = M.fund_code and CONVERT(nvarchar(50),valuation_date,103) = CONVERT(nvarchar(50),GETDATE() ,103)

UNION ALL 

SELECT M.fund_code,
		'' fund_name,
		valuation_date,
		bid_price,
		offer_price,
		currency,
        null old_price
FROM 
  R_FUND_DAILY_PRICE R, R_FUND M where R.fund_code=@fundCode and R.fund_code = M.fund_code and valuation_date&gt;=GETDATE()-20
) A  order by fund_code, valuation_date desc, fund_name desc
">
<SelectParameters>
            <asp:QueryStringParameter DefaultValue="EUEF" Name="fundCode" 
                QueryStringField="fundCode" Type="string" />
        </SelectParameters>
</asp:SqlDataSource>


    <br />
    <br /><br />
<%--
    <table class="tbl_funds" width="100%" style="border-collapse: collapse">
        <colgroup>
            <col style="">
            <col style="width: 40%; text-align: left;">
            <col style="text-align: left">
            <col style="text-align: left;">
            <col style="text-align: left">
            <col style="text-align: left;">
            <col style="text-align: left;">
        </colgroup>
        <tr>
            <th>
            </th>
            <th>
                Fund Name
            </th>
            <th>
                Currency
            </th>
            <th>
                Offer Price
            </th>
            <th>
                Bid Price
            </th>
            <th>
                Valuation Date
            </th>
            <th>
                Price Status
            </th>
        </tr>
        <tr>
            <td>
                <asp:Image ID="arrow_AsiaFund" runat="server" ImageUrl="~/Retirement/Images/arrow_right.gif" />
            </td>
            <td>
                WorldTrade Asia Fund
            </td>
            <td>
                S$
            </td>
            <td>
                2.454
            </td>
            <td>
                2.331
            </td>
            <td>
                11/20/14
            </td>
            <td>
                <asp:Image ID="priceStatus_AsiaFund" runat="server" ImageUrl="~/Retirement/Images/no_change.gif" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Image ID="arrow_ChinaEquityFund" runat="server" ImageUrl="~/Retirement/Images/arrow_right.gif" />
            </td>
            <td>
                WorldTrade China Equity Fund
            </td>
            <td>
                S$
            </td>
            <td>
                2.047
            </td>
            <td>
                1.944
            </td>
            <td>
                11/20/14
            </td>
            <td>
                <asp:Image ID="priceStatus_ChinaEquityFund" runat="server" ImageUrl="~/Retirement/Images/price_up.gif" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Image ID="arrow_EuropeanEquityFund" runat="server" ImageUrl="~/Retirement/Images/arrow_right.gif" />
            </td>
            <td>
                WorldTrade European Equity Fund
            </td>
            <td>
                S$
            </td>
            <td>
                0.918
            </td>
            <td>
                0.873
            </td>
            <td>
                11/20/14
            </td>
            <td>
                <asp:Image ID="priceStatus_EuropeanEquityFund" runat="server" ImageUrl="~/Retirement/Images/price_down.gif" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Image ID="arrow_GlobalEquityFund" runat="server" ImageUrl="~/Retirement/Images/arrow_right.gif" />
            </td>
            <td>
                WorldTrade Global Equity Fund
            </td>
            <td>
                S$
            </td>
            <td>
                0.935
            </td>
            <td>
                0.898
            </td>
            <td>
                11/20/14
            </td>
            <td>
                <asp:Image ID="priceStatus_GlobalEquityFund" runat="server" ImageUrl="~/Retirement/Images/price_up.gif" />
            </td>
        </tr>
    </table>--%>
</asp:Content>
